﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<TemplateWeb.Models.ViewModels.GroupViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <div id="DivTinTucVTA" style="display: block;">
        <table id="VTA_LoadContent_ctl00_VTA_LoadBody1_TblLoadQuanCao" style="width: 100%;
            border-collapse: collapse;" border="0" cellpadding="0" cellspacing="0">
            <tbody>
                <tr>
                    <td style="width: 100%;" valign="top">
                        <table width="100%" border="0" cellpadding="0" cellspacing="0">
                            <tbody>
                                <tr>
                                    <td class="maintabletitlebg" align="center" height="42">
                                        <h1>
                                            Giỏ hàng</h1>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="graytdborder" style="border-right-width: 0px ! important;" align="center">
                                        <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                            <tbody>
                                                <tr>
                                                    <td class="tdcell" align="left" width="100%">
                                                        <div style="padding: 10px; font-size: 12px;">
                                                            <table rules="all" style="width: 100%; border: 1px solid rgb(187, 216, 241);" cellpadding="10"
                                                                cellspacing="10">
                                                                <tbody>
                                                                    <tr style="color: rgb(2, 79, 147); background-color: rgb(239, 249, 255); font-weight: bold;"
                                                                        align="center">
                                                                        <td>
                                                                            Hình ảnh
                                                                        </td>
                                                                        <th style="text-align: left;">
                                                        Tên sản phẩm
                                                    </td>
                                                    <td>
                                                        Loại sản phẩm
                                                    </td>
                                                    <td>
                                                        Số lượng
                                                    </td>
                                                    <td>
                                                        Đơn giá
                                                    </td>
                                                    <td>
                                                        Thành tiền
                                                    </td>
                                                    <td>
                                                        Xóa
                                                    </td>
                                                </tr>
                                                <% foreach (var obj in Model.ShoppingCartModel.CartItems)
                                                   { %>
                                                <tr align="center">
                                                    <td>
                                                        <img src="../../Content/Images/Items/<%= obj.SanPham.HinhMinhHoa %>" alt="<%= obj.SanPham.TenSanPham %>"
                                                            style="height: 80px;">
                                                    </td>
                                                    <td class="font_blue" align="left">
                                                        <b><span id="ContentPlaceHolder1_dgShopCart_ProductName_0">
                                                            <%= obj.SanPham.TenSanPham %></span></b>
                                                    </td>
                                                    <td class="font_blue" align="center">
                                                        <b>
                                                            <%= obj.SanPham.LoaiSanPham %></b>
                                                    </td>
                                                    <td>
                                                        <script type="text/javascript">
                                                            function ReCalcOrder(itemid) {
                                                                var num = document.getElementsByName("NumItem" + itemid).item(0);
                                                                window.location.href = "../Home/UpdateQuantityToCart?id=" + itemid + "&num=" + num.value;
                                                            }
                                                        </script>
                                                        <input type="text" name="NumItem<%= obj.IDSanPham %>" value="<%= obj.SoLuong %>"
                                                            style="width: 15px; font-size: 10px; text-align: center;" maxlength="2" onkeyup='ReCalcOrder(<%= obj.IDSanPham %>);'>
                                                    </td>
                                                    <td align="right">
                                                        <span class="font_price">
                                                            <%= string.Format("{0:0,0}", obj.SanPham.GiaBan)%>
                                                            VNĐ</span>
                                                    </td>
                                                    <td align="right">
                                                        <span class="font_price">
                                                            <%= string.Format("{0:0,0}", obj.SanPham.GiaBan * obj.SoLuong)%>
                                                            VNĐ</span>
                                                    </td>
                                                    <td>
                                                        <a href="<%= Url.Action("RemoveFromCart", "Home", new { id = obj.ID }) %>" title="Remove from cart"
                                                            class="RemoveLink">
                                                            <img src="../../../Content/Images/Home/delete.gif" alt="Remove From Cart" border="0" />
                                                        </a>
                                                    </td>
                                                </tr>
                                                <% } %>
                                            </tbody>
                                        </table>
                                        <div>
                                            <div class="clear">
                                            </div>
                                            <div style="float: right;" class="total_cart">
                                                <p style="margin: 10px;">
                                                    Tổng tiền: <span class="font_price"><b><span id="ContentPlaceHolder1_lblTotal">
                                                        <%= string.Format("{0:0,0}", Model.ShoppingCartModel.CartTotal) %>
                                                        VNĐ</span></b></span></p>
                                            </div>
                                            <div class="clear">
                                            </div>
                                            <br />
                                            <br />
                                            <br />
                                            <% if (Model.ShoppingCartModel.CartItems.Count > 0)
                                               { %>
                                            <div style="float: right;">
                                                <% using (Html.BeginForm("Approve", "Home", FormMethod.Post))
                                                   { %>
                                                <input type="submit" name="sbt" id="sbt" value="Thanh toán" style="background-image: url(../../../Content/Images/Home/bgbutton.jpg);
                                                    color: #FFFFFF; font-size: 16px; font-weight: bold; border: 1px #DBDBDB solid;
                                                    height: 30px; cursor: pointer;" />
                                                <% } %>
                                            </div>
                                            <% } %>
                                            <div class="clear" style="height: 40px">
                                            </div>
                                        </div>
    </div>
    </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </td> </tr> </tbody>
    </table> </div>
</asp:Content>
